package com.eden.door.component;

import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import com.eden.door.view.MainView;

/**
 * 菜单按钮
 * @author Eden
 * @Date 2012-5-5 18:05
 * @version v1.0
 * 
 */
public class MenuButton extends JButton implements ActionListener{

	private static final long serialVersionUID = 1L;
	
	private MainView mainView ;
	private PopupMenu popup ;
	
	public MenuButton(MainView mainView , String name) {
		super(name) ;
		this.mainView = mainView ;
		this.addActionListener(this) ;
		this.popup = new PopupMenu() ;
	}
	
	Point popupLocation ;
	@Override
	public void actionPerformed(ActionEvent e) {
		popupLocation = mainView.getJplMenu().getLocation() ;
		this.popup.show(this.mainView.getJplMain(), popupLocation.x, popupLocation.y + this.mainView.getJplMenu().getHeight())  ;
	}

}
